﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Code.BLL.Arithmetic.Comm
{
    /// <summary>
    /// 验证用户号码的格式
    /// </summary>
    public class RegexFormats
    {
        //后向引用构造:
        // 1. ?<名称>范围 表示在范围中记录一个字符
        // 2. \k<名称> 表示记录的字符
        // 3. ?<num>\d\k<num>abc88def 可匹配'abc88def'中的'88'


        /// <summary>
        /// 一星验证格式
        /// </summary>
        public static Regex OneStar= new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}$", RegexOptions.Compiled);
        /// <summary>
        /// 二星验证格式
        /// </summary>
        public static Regex TwoStar= new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10},(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}$", RegexOptions.Compiled);
        /// <summary>
        /// 三星验证格式
        /// </summary>
        public static Regex ThreeStar= new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}(,(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}){2}$", RegexOptions.Compiled);
        /// <summary>
        /// 四星验证格式
        /// </summary>
        public static Regex FourStar= new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}(,(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}){3}$", RegexOptions.Compiled);
        /// <summary>
        /// 五星验证格式
        /// </summary>
        public static Regex FiveStar= new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}(,(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}){4}$", RegexOptions.Compiled);
        /// <summary>
        /// 三星定位胆
        /// </summary>
        public static Regex SanXingDingWeiDan = new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{0,10}(,(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{0,10}){2}$", RegexOptions.Compiled);
        /// <summary>
        /// 三星直选和值
        /// </summary>
        public static Regex ZhiHe = new Regex(@"^\d\d?(,\d\d?){0,28}$", RegexOptions.Compiled);
        /// <summary>
        /// 三星组选和值
        /// </summary>
        public static Regex ZuHe = new Regex(@"^\d\d?(,\d\d?){0,26}$", RegexOptions.Compiled);

        /// <summary>
        /// 三星组选
        /// </summary>
        public static Regex ZuSan = new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{1,10}$|^(?<num>\d)\k<num>(?!\k<num>)\d$|^(?<num1>\d)(?!\k<num1>)(?<num2>\d)\k<num2>$|^(?<num>\d)(?!\k<num>)\d\k<num>$", RegexOptions.Compiled);

        /// <summary>
        /// 五星定位胆
        /// </summary>
        public static Regex WuXingDingWeiDan = new Regex(@"^(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{0,10}(,(?!\d{0,}(?<num>\d)\d{0,}\k<num>)\d{0,10}){4}$", RegexOptions.Compiled);

        /// <summary>
        /// 任选1
        /// </summary>
        public static Regex Chose1 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{1,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选2
        /// </summary>
        public static Regex Chose2 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{2,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选3
        /// </summary>
        public static Regex Chose3 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{3,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选4
        /// </summary>
        public static Regex Chose4 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{4,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选5
        /// </summary>
        public static Regex Chose5 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{5,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选6
        /// </summary>
        public static Regex Chose6 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{6,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选7
        /// </summary>
        public static Regex Chose7 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{7,11}$", RegexOptions.Compiled);
        /// <summary>
        /// 任选8
        /// </summary>
        public static Regex Chose8 = new Regex(@"^(?![1-9ab]{0,}(?<num>[1-9ab])[1-9ab]{0,}\k<num>)[1-9ab]{8,11}$", RegexOptions.Compiled);



    }
}
